package com.cloud.alibaba.producer.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PreDestroy;


@Configuration
public class ApplicationContextUtil implements ApplicationContextAware{
    public static ApplicationContext applicationContext;
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ApplicationContextUtil.applicationContext =applicationContext;
    }


    @PreDestroy
    public void destroy(){
        System.out.println("com.cloud.alibabacloud.util.ApplicationContextUtil.destroy!!!");
    }
}
